package com.wchat.network.message.file;

import java.io.File;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

import com.wchat.network.message.Message;

@Root
public class FileMessage extends Message {

	private static final long serialVersionUID = 5849910095607840643L;
	
	@Element
	private FileInfo fileInfo = new FileInfo();
	
	public void setFile(File file) {
		fileInfo.path = file.getAbsolutePath();
		fileInfo.fileName = file.getName();
		fileInfo.size = file.length();
	}

	@Override
	public byte getType() {
		return TYPE_FILE;
	}

	public FileInfo getFileInfo() {
		return fileInfo;
	}

}
